package fm.entity;

import com.mongodb.DBObject;

import javax.persistence.*;
import java.util.List;

/**
 * Created by 宏炜 on 2017-05-30.
 */
@Entity
@Table(name = "section", schema = "neiyi", catalog = "")
public class Section {
    private Long id;
    private String sectionName;
    private Integer status;
    private String sectionDesc;
    private String sectionImage;
    private Byte payForTop;
    private Byte payForBanner;

    private SectionPayResolve payForTopResolve;
    private SectionPayResolve payForBannerResolve;


    @OneToOne(targetEntity = SectionPayResolve.class)
    @JoinColumn(name="pay_for_banner_id",updatable = false)
    public SectionPayResolve getPayForBannerResolve() {
        return payForBannerResolve;
    }

    public void setPayForBannerResolve(SectionPayResolve payForBannerResolve) {
        this.payForBannerResolve = payForBannerResolve;
    }
    @OneToOne(targetEntity = SectionPayResolve.class)
    @JoinColumn(name="pay_for_top_id",updatable = false)
    public SectionPayResolve getPayForTopResolve() {

        return payForTopResolve;
    }

    public void setPayForTopResolve(SectionPayResolve payForTopResolve) {
        this.payForTopResolve = payForTopResolve;
    }

    public void setId(long id) {
        this.id = id;
    }



    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false, insertable = true, updatable = true)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "section_name", nullable = true, insertable = true, updatable = true, length = 50)
    public String getSectionName() {
        return sectionName;
    }

    public void setSectionName(String sectionName) {
        this.sectionName = sectionName;
    }

    @Basic
    @Column(name = "status", nullable = true, insertable = true, updatable = true)
    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Basic
    @Column(name = "section_desc", nullable = true, insertable = true, updatable = true, length = 100)
    public String getSectionDesc() {
        return sectionDesc;
    }

    public void setSectionDesc(String sectionDesc) {
        this.sectionDesc = sectionDesc;
    }

    @Basic
    @Column(name = "section_image", nullable = true, insertable = true, updatable = true, length = 500)
    public String getSectionImage() {
        return sectionImage;
    }

    public void setSectionImage(String sectionImage) {
        this.sectionImage = sectionImage;
    }

    @Basic
    @Column(name = "pay_for_top")
    public Byte getPayForTop() {
        return payForTop;
    }

    public void setPayForTop(Byte payForTop) {
        this.payForTop = payForTop;
    }

    @Basic
    @Column(name = "pay_for_banner")
    public Byte getPayForBanner() {
        return payForBanner;
    }

    public void setPayForBanner(Byte payForBanner) {
        this.payForBanner = payForBanner;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Section section = (Section) o;

        if (id != null ? !id.equals(section.id) : section.id != null) return false;
        if (sectionName != null ? !sectionName.equals(section.sectionName) : section.sectionName != null) return false;
        if (status != null ? !status.equals(section.status) : section.status != null) return false;
        if (sectionDesc != null ? !sectionDesc.equals(section.sectionDesc) : section.sectionDesc != null) return false;
        if (sectionImage != null ? !sectionImage.equals(section.sectionImage) : section.sectionImage != null)
            return false;
        if (payForTop != null ? !payForTop.equals(section.payForTop) : section.payForTop != null) return false;
        if (payForBanner != null ? !payForBanner.equals(section.payForBanner) : section.payForBanner != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (sectionName != null ? sectionName.hashCode() : 0);
        result = 31 * result + (status != null ? status.hashCode() : 0);
        result = 31 * result + (sectionImage != null ? sectionImage.hashCode() : 0);
        result = 31 * result + (sectionDesc != null ? sectionDesc.hashCode() : 0);
        result = 31 * result + (payForTop != null ? payForTop.hashCode() : 0);
        result = 31 * result + (payForBanner != null ? payForBanner.hashCode() : 0);
        return result;
    }


}
